package com.weipai;

import org.apache.activemq.ActiveMQConnection;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.ScheduledMessage;
import org.apache.rocketmq.client.exception.MQClientException;
import org.apache.rocketmq.client.producer.DefaultMQProducer;
import org.apache.rocketmq.client.producer.SendResult;
import org.apache.rocketmq.common.message.Message;
import org.apache.rocketmq.remoting.common.RemotingHelper;
import javax.jms.*;
import java.util.Date;

import static com.weipai.ServerTcp.producer;

/**
 * Created by Administrator on 2017/11/18 0018.
 */
public final class RocketmqGenerateTask {
    public static String broker_url = "47.97.4.127:9876";
    private static String  queue_name = "";


    //消息列队生成
    public static  boolean GenerateMessage(final String body,String tag,String uuid,String ProducerGroupName, String topname,long Deliveryexecutiontime, long currentunixtime, String queue_name, String tcpurl) throws MQClientException {


            try {
                    producer.setProducerGroup(ProducerGroupName);
                    Message msg = new Message(topname, tag, uuid, body.getBytes(RemotingHelper.DEFAULT_CHARSET));
                    SendResult sendResult = producer.send(msg);
                    System.out.printf("%s%n", sendResult);
                }
            catch (Exception e) {
                e.printStackTrace();
            }


        return Boolean.TRUE;
    }


}
